package UIFree
{
	import flash.events.TimerEvent;
	import flash.utils.Timer;

	public class uif_Timer extends Timer {
		private var _params: Object;
		public function uif_Timer(delay:Number, TimerProc: Function, CompleteProc: Function=null, repeatCount:int=0, a_params: Object=null) {
			super(delay, repeatCount);
			
			function doComplete(e: TimerEvent): void {
				removeEventListener(TimerEvent.TIMER_COMPLETE, doComplete);
				CompleteProc(e);
			}
			
			_params = a_params;
			if (TimerProc != null) addEventListener(TimerEvent.TIMER, TimerProc);
			if (CompleteProc != null) {
				addEventListener(TimerEvent.TIMER_COMPLETE, doComplete);
			}
			start();
		}
		
		public function get params(): Object {
			return _params;
		}
		
		public static function one(wait_mlsec: uint, func: Function): uif_Timer {
			return new uif_Timer(wait_mlsec, null, func, 1);
		}
	}
}